<?php  
/**
* Class User
* 
* @author PHP-SONG
* @package Kernel
* @version 0.1
* 
*/
class UserCurrent
{
    function __construct() {
        if(isset($_SESSION[NAME_SESSION_USER])) {
            
        }
    }  
    
    /**
    * Register Session
    * 
    * @param String $name
    * @param mixed $value
    * @return Boolean
    * @access Public
    */
    public function registerSession($name = 'song_user', $value = false)
    {
        if(!$value || empty($value)){
            return false;
        }
        $_SESSION[$name] = $value;
        return true;
    }
    
    /**
    * Clear Session
    * 
    * @param String $name 
    * @return Boolean
    * @access Public
    */
    public function clearSession($name = false){
        if(!$name){
            return false;
        }    
        unset($_SESSION[$name]);
        return true;
    } 
    
    /**
    * Check Login
    * 
    * @return Boolean
    * @access Public
    */
    public function isLogin()
    {
        return isset($_SESSION[NAME_SESSION_USER]);    
    }   
    
    /**
    * Check Login Admin
    * 
    * @return Boolean
    * @access Public
    */
    public function isAdmin()
    {
        return isset($_SESSION[NAME_SESSION_SYSTEM]);    
    }  
    
    public function logOut($name = false)
    {
        return $this->clearSession($name);    
    }       
}
?>
